package marker.micro.sys.controller;

import java.security.Principal;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PubController {

    @GetMapping("/index")
    @PreAuthorize("hasAuthority('query-demo')")
    public String index() {
	return "this is pub index";
    }
    
    @GetMapping("/welcome")
    public String welcome() {
	return "this is welcome index";
    }
    
    @GetMapping("/user")
    public String user(Principal principal) {
	return "welcome! "+principal.getName();
    }
    
}
